package com.next.muscu.data;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.Date;

public class Measurement implements MyDataObject, java.io.Serializable {

	public static final String PP_ID = "id";
	public static final String PP_DESCRIPTION = "description";
	public static final String PP_PHOTO_PATH = "photoPath";
	public static final String PP_VALUE_MEASURED = "valueMeasured";
	public static final String PP_UNIT = "unit";
	public static final String PP_DATE_MEASURED = "dateMeasured";
	public static final String PP_ID_USER = "idUser";
	
	private Integer id;
	private String description  = new String("");;
	private String photoPath  = new String("");;
	private String valueMeasured  = new String("");;
	private String unit  = new String("");;
	private Date dateMeasurement;
	private int idUser = new Integer(1);
	PropertyChangeSupport ppChangeSupport = new PropertyChangeSupport(this);
	
	public Measurement() {
	}

	public Measurement(String description, int idUser) {
		this.description = description;
		this.idUser = idUser;
	}

	public Measurement(String description, String photoPath,
			String valueMeasured, String unit, Date dateMeasurement, int idUser) {
		this.description = description;
		this.photoPath = photoPath;
		this.valueMeasured = valueMeasured;
		this.unit = unit;
		this.dateMeasurement = dateMeasurement;
		this.idUser = idUser;
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getPhotoPath() {
		return this.photoPath;
	}

	public void setPhotoPath(String photoPath) {
		this.photoPath = photoPath;
	}

	public String getValueMeasured() {
		return this.valueMeasured;
	}

	public void setValueMeasured(String valueMeasured) {
		this.valueMeasured = valueMeasured;
	}

	public String getUnit() {
		return this.unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public Date getDateMeasurement() {
		return this.dateMeasurement;
	}

	public void setDateMeasurement(Date dateMeasurement) {
		this.dateMeasurement = dateMeasurement;
	}

	public int getIdUser() {
		return this.idUser;
	}

	public void setIdUser(int idUser) {
		this.idUser = idUser;
	}

	@Override
	public boolean copy(MyDataObject o) {
		// TODO faire la methode copy de Measurement
		return false;
	}

	@Override
	public void Create() {
		// TODO faire la methode create de Measurement
		
	}



	@Override
	 public boolean equals(Object o) {
	        if (!(o instanceof Measurement))
	            return false;
	        Measurement e = (Measurement)o;
	        return e.getId().equals(id);
	    }
	@Override
	    public int hashCode() {
	        return id.hashCode();
	    }

	    public int compareTo(Measurement e) {
	        return this.getId().compareTo(e.getId());
	    }
		public void addPropertyChangeListener(PropertyChangeListener listener) {
			ppChangeSupport.addPropertyChangeListener(listener);
		}
		public void addPropertyChangeListener(String propertyName,
				PropertyChangeListener listener) {
			ppChangeSupport.addPropertyChangeListener(propertyName, listener);
		}
		public PropertyChangeListener[] getPropertyChangeListeners() {
			return ppChangeSupport.getPropertyChangeListeners();
		}
		public PropertyChangeListener[] getPropertyChangeListeners(
				String propertyName) {
			return ppChangeSupport.getPropertyChangeListeners(propertyName);
		}
		public void removePropertyChangeListener(PropertyChangeListener listener) {
			ppChangeSupport.removePropertyChangeListener(listener);
		}
		public void removePropertyChangeListener(String propertyName,
				PropertyChangeListener listener) {
			ppChangeSupport
					.removePropertyChangeListener(propertyName, listener);
		}
}
